package practice;

import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;

public class _17Diode {

    static int n,k;
    static int[] pos,nag;
    static long ans = 0;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        k = scanner.nextInt();
        pos = new int[n];
        nag = new int[n];

        int canHandle = 0;
        Integer[] dif = new Integer[n];
        for (int i = 0;i < n;i++){
            pos[i] = scanner.nextInt();
            ans += pos[i];
        }
        for (int i = 0;i < n;i++){
            nag[i] = scanner.nextInt();
            //  dif为正数说明可操作
            dif[i] = pos[i] - nag[i];
            if (dif[i] > 0){
                canHandle++;
            }
        }
        scanner.close();

        Arrays.sort(dif,new Comparator<Integer>(){
            public int compare(Integer a,Integer b){
                return b-a;
            }
        });
        if (k >= canHandle){
            //  全部反向
            for (int i = 0;dif[i] > 0 && i < n;i++){
                ans -= dif[i];
            }
        }else {
            //  反向前k个
            for (int i = 0;i < k;i++){
                ans -= dif[i];
            }
        }
        System.out.println(ans);
    }
}
